<%@ Page Language="C#" MasterPageFile="~/FiledbookMaster.Master" AutoEventWireup="true" CodeBehind="FieldMaps.aspx.cs" Inherits="Fieldbook.Testwebsite.User.FieldMaps" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function ShowHideDiv(on, elemID)
        {
            var divElem = document.getElementById(elemID);
            if (on)
            {
                divElem.style.display = "block";
            }
            else 
            {
                divElem.style.display = "none";
            }
            return false;
        }
    </script>
    <a href="#" onclick="return ShowHideDiv(true, 'divAddFieldMap')">Add field map</a>
    <br />
    <br />
    <asp:Label ID="lblOperationStatus" runat="server" EnableViewState="false"/>
    <div id="divAddFieldMap" style="display:none">
        <table>
        <tr>
            <td>
                Description
            </td>
            <td>
                <asp:TextBox ID="txtDescription" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                Postal code
            </td>
            <td>
                <asp:TextBox ID="txtPostalCode" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                Map image
            </td>
            <td>
                <asp:FileUpload ID="FileUpload1" runat="server" Width="232px" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:LinkButton id="linkAddMachine" runat="Server" OnCommand="linkAddMap_Command" Text="Add"/>
                <a href="#" onclick="return ShowHideDiv(false, 'divAddFieldMap')">Cancel</a>                        
            </td>
        </tr>  
    </table>
    </div>
    <br />
    <asp:GridView ID="dgvFieldMaps" runat="server" AutoGenerateColumns="false" 
        DataSourceID="FieldMapsODS" 
        DataKeyNames="FieldMapID"
        OnSelectedIndexChanged="dgvFieldMaps_SelectedIndexChanged">
        <Columns>
            <asp:CommandField ShowSelectButton="true" />
            <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
        </Columns>
    </asp:GridView>
    <br />
    <asp:Image ID="imgFieldMap" runat="server" AlternateText="no map loaded" Width="860px" Height="400px"
        GenerateEmptyAlternateText="true"
        Visible="false"/>
    <br />
    <asp:ObjectDataSource ID="FieldMapsODS" runat="server" TypeName="Fieldbook.Business.FieldController" SelectMethod="LoadFieldMaps"/>
</asp:Content>
